package fun.lifepoem.jobs.jobHandler;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import fun.lifepoem.notification.EmailNotificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * @author Yiwyn
 * @create 2022/7/21 12:36
 */
@Component
public class DemoHandle {

    @Autowired
    EmailNotificationService emailNotificationService;


    @XxlJob("demoJobHandler")
    public void demoJobHandler() throws Exception {
        String param = XxlJobHelper.getJobParam();


        XxlJobHelper.log("XXL-JOB, Hello World. {}", param);
        for (int i = 0; i < 5; i++) {
            XxlJobHelper.log("beat at:" + i);
            TimeUnit.SECONDS.sleep(2);
        }
    }

}
